package test5;

import java.util.Scanner;

public class Main2 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		double[] arr = new double[n];
        for (int i = 0; i < arr.length;) {
        	String s=in.next();
        	try{
        		arr[i] = Integer.parseInt(s);
        	}
        	catch(IllegalArgumentException e)
        	{
        		System.out.println(e);
        		i--;
        	}
        	i++;
		}
        while(in.hasNextInt())
		{
        	int begin=in.nextInt();
        	int end = in.nextInt();
			try{
			 System.out.println(ArrayUtils.findMax(arr, begin,end));
			}catch(IllegalArgumentException e)
			{
				System.out.println(e);
			}
		}
		try {
		     System.out.println(ArrayUtils.class.getDeclaredMethod("findMax", double[].class,int.class,int.class));
		} catch (Exception e) {
		}
		in.close();
	}
}